package pATT.profilingAlgorithm.PersonalSearcher;


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.Vector;

public class FileVector extends Vector {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public FileVector(){
		super();
	}

	public FileVector(int n){
		super();
		setSize(n);
	}

	@SuppressWarnings("unchecked")
	public void load(String file) throws IOException{
    	BufferedReader in = new BufferedReader(new FileReader(file));
        String word = in.readLine();
        while (word!=null){
        	this.addElement(word);
			word=in.readLine();
        }
        in.close();
	}

	public void download(String file) throws IOException{
                DataOutputStream out=new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
                for(int i=0;i<this.size();i++){
                       out.writeBytes((String)this.elementAt(i));
                       out.writeBytes("\n");
                }
                out.close();
        }
}
